import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
//引入路由
import {HashRouter as Router,Switch,Route,Redirect} from "react-router-dom"
//引入antd组件的样式
import 'antd/dist/antd.css';
//引入路由文件
import {mainRoutes} from "./routes/index.js"
//引入redux模块
import store from "./redux/store.js"
import {Provider} from "react-redux"
ReactDOM.render(
<Provider store={store}>
<Router>
   <Switch>
		<Route path="/admin" render={routeProps=> <App {...routeProps}/>} />
		{
			mainRoutes.map(route=>{
				return <Route key={route.path} path={route.path} component={route.component}/>
			})
		}
		<Redirect to="/admin" from="/" />
		<Redirect to="/404" />
   </Switch>
</Router>
</Provider>
 ,
  document.getElementById('root')
)

